import Authorization.User;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;

/**
 * Created with IntelliJ IDEA.
 * User: HAiL
 * Date: 05.11.13
 * Time: 21:47
 * To change this template use File | Settings | File Templates.
 */
public class UserTests {
    User user;
    @Before
    public void initialize(){
      user = new User("log","pass");
    }

    @Test
    public void testGetLogin() throws Exception {

          assertEquals("log",user.getLogin());
    }

    @Test
    public void testGetPassword() throws Exception {

        assertEquals("pass",user.getPassword());
    }

    @Test
    public void testEqualsTrue(){
        User equalUser = new User("log","pass");
        assertTrue(" All nice",user.equals(equalUser));
    }

    @Test
    public void testEqualsFalse(){
        User notEqualUser = new User("not","not");
        assertFalse("Fail",user.equals(notEqualUser));
    }

    @Test
    public void testHash(){
        User userClone = new User("log","pass");
        assertTrue(user.equals(userClone)&&userClone.equals(user));
        assertTrue(user.hashCode()==userClone.hashCode());

    }


}
